package com.toycloud.system.service.impl.business;

import java.util.List;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.toycloud.business.dto.params.business.FeedbackProductParamManagerDetailParams;
import com.toycloud.business.dto.results.CommonResult;
import com.toycloud.common.core.utils.DateUtils;
import com.toycloud.system.domain.business.FeedbackApplicationVersionManager;
import com.toycloud.system.domain.business.FeedbackApplicationVersionManagerDetail;
import com.toycloud.system.domain.business.FeedbackProductParamManagerDetail;
import com.toycloud.system.mapper.business.FeedbackProductParamManagerDetailMapper;
import com.toycloud.system.service.business.IFeedbackProductParamManagerDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 产品参数管理关联Service业务层处理
 * 
 * @author ruoyi
 * @date 2024-12-18
 */
@Service
public class FeedbackProductParamManagerDetailServiceImpl implements IFeedbackProductParamManagerDetailService
{
    @Resource
    private FeedbackProductParamManagerDetailMapper feedbackProductParamManagerDetailMapper;

    /**
     * 查询产品参数管理关联
     * 
     * @param id 产品参数管理关联主键
     * @return 产品参数管理关联
     */
    @Override
    public FeedbackProductParamManagerDetail selectFeedbackProductParamManagerDetailById(Long id)
    {
        return feedbackProductParamManagerDetailMapper.selectFeedbackProductParamManagerDetailById(id);
    }

    /**
     * 查询产品参数管理关联列表
     * 
     * @param feedbackProductParamManagerDetailParams 产品参数管理关联
     * @return 产品参数管理关联
     */
    @Override
    public CommonResult<List<FeedbackProductParamManagerDetail>> selectFeedbackProductParamManagerDetailList(FeedbackProductParamManagerDetailParams feedbackProductParamManagerDetailParams)
    {
        PageHelper.startPage(feedbackProductParamManagerDetailParams.getCurrent(), feedbackProductParamManagerDetailParams.getPageSize());
        List<FeedbackProductParamManagerDetail> feedbackProductParamManagerDetails = feedbackProductParamManagerDetailMapper.selectFeedbackProductParamManagerDetailList(feedbackProductParamManagerDetailParams);
        Page<FeedbackProductParamManagerDetail> feedbackApplicationVersionManagersPage = (Page<FeedbackProductParamManagerDetail>) feedbackProductParamManagerDetails;
        return CommonResult.Success((int) feedbackApplicationVersionManagersPage.getTotal(), feedbackProductParamManagerDetails);

    }

    /**
     * 新增产品参数管理关联
     * 
     * @param feedbackProductParamManagerDetail 产品参数管理关联
     * @return 结果
     */
    @Override
    public int insertFeedbackProductParamManagerDetail(FeedbackProductParamManagerDetail feedbackProductParamManagerDetail)
    {
        feedbackProductParamManagerDetail.setCreateTime(DateUtils.getNowDate());
        return feedbackProductParamManagerDetailMapper.insertFeedbackProductParamManagerDetail(feedbackProductParamManagerDetail);
    }

    /**
     * 修改产品参数管理关联
     * 
     * @param feedbackProductParamManagerDetail 产品参数管理关联
     * @return 结果
     */
    @Override
    public int updateFeedbackProductParamManagerDetail(FeedbackProductParamManagerDetail feedbackProductParamManagerDetail)
    {
        feedbackProductParamManagerDetail.setUpdateTime(DateUtils.getNowDate());
        return feedbackProductParamManagerDetailMapper.updateFeedbackProductParamManagerDetail(feedbackProductParamManagerDetail);
    }

    /**
     * 批量删除产品参数管理关联
     * 
     * @param ids 需要删除的产品参数管理关联主键
     * @return 结果
     */
    @Override
    public int deleteFeedbackProductParamManagerDetailByIds(Long[] ids)
    {
        return feedbackProductParamManagerDetailMapper.deleteFeedbackProductParamManagerDetailByIds(ids);
    }

    /**
     * 删除产品参数管理关联信息
     * 
     * @param id 产品参数管理关联主键
     * @return 结果
     */
    @Override
    public int deleteFeedbackProductParamManagerDetailById(Long id)
    {
        return feedbackProductParamManagerDetailMapper.deleteFeedbackProductParamManagerDetailById(id);
    }
    @Override
    public int deleteFeedbackProductParamManagerDetailByParentid(String id)
    {
        return feedbackProductParamManagerDetailMapper.deleteFeedbackProductParamManagerDetailByParentid(id);
    }
}
